import { CanAuthProvide } from './guard/canLoad.guard';
import { RentManagementPaymentComponent } from './components/rent-management-payment/rent-management-payment.component';
import { MessageNotificationComponent } from './components/message-notification/message-notification.component';
import { IndexComponent } from './views/index/index.component';
import { RegisterComponent } from './views/register/register.component';
import { LoginComponent } from './views/login/login.component';
import { RentalInformationComponent } from './components/rental-information/rental-information.component';
import { RentManagementComponent } from './components/rent-management/rent-management.component';
import { PersonalDataComponent } from './components/personal-data/personal-data.component';
import { NgModule, Component } from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import { PersonalCenterComponent } from './views/personal-center/personal-center.component';
import {PyContainerComponent, PyLoggedInGuard, PyLoginComponent, PyLoginGuard} from 'pengesoft-ng-lib';
import { HouseDetailsComponent } from './components/house-details/house-details.component';
import { HomeComponent } from './components/home/home.component';
import { HouseComponent } from './components/house/house.component';
import { SignComponent } from './components/sign/sign.component';
import { ContractComponent } from './components/contract/contract.component';
import { CollectionComponent } from './components/collection/collection.component';
import { RentManagementInformationComponent } from './components/rent-management-information/rent-management-information.component';
import { ReverseManagementComponent } from './components/reverse-management/reverse-management.component';


const routes: Routes = [
  {
    path: '',
    redirectTo: '/home',
    pathMatch: 'full'
  },
  {
    path: 'home',
    component: HomeComponent,
  },
  {
    path: 'rental-options',
    component: HouseComponent,
  },
  {
    path:'houseDetails',
    component:HouseDetailsComponent,
  },
  {
    path: 'sign',
    component: SignComponent
  },
  {
    path:'contract',
    component:ContractComponent,
  },
  {
    path: 'personal-center',
    component: PersonalCenterComponent,
    canActivate: [CanAuthProvide],
    children: [
      {
        path: '',
        redirectTo: 'personal-data',
        pathMatch: 'full'
      },
      {
        path: 'personal-data',
        component: PersonalDataComponent
      },
      {
        path: 'rent-management',
        component: RentManagementComponent,
        children: [
          {
            path: 'management-information',
            component: RentManagementInformationComponent
          }
        ]
        // children: [
        //   {
        //     path: 'rental-information',
        //     component: RentalInformationComponent
        //   }
        // ]
      },
      {
        path: 'rental-information',
        component: RentalInformationComponent
      },
      {
        path: 'message-notification',
        component: MessageNotificationComponent
      },
      {
        path: 'rent-collection',
        component: CollectionComponent
      },
      {
        path: 'reverse-management',
        component: ReverseManagementComponent
      }
    ]
  },
  {
    path: 'login',
    component: LoginComponent
  },
  {
    path: 'register',
    component: RegisterComponent
  }

];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule {
}

